package com.lvmama.pet.sync.service.util;

import java.util.ArrayList;
import java.util.List;

import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.lvmama.pet.sync.service.spring.SyncApplicationContextUtil;


public  class SyncContextFactory {

    public static ClassPathXmlApplicationContext context ;
    public  static List<String> configs = new ArrayList<String>();

    static Object LOCK1 = new Object();


    private SyncContextFactory() {

    }

    public static void  refreshContext() {
        synchronized (LOCK1) {
                String[] arrayConfigs =  configs.toArray(new String[configs.size()]);
                
                context =new ClassPathXmlApplicationContext(arrayConfigs);
                
                context.setParent(SyncApplicationContextUtil.applicationContext);
                context.refresh();
             
            
        }
        
    }

   
}
